<?php

namespace App\Models\Order;

use Hyn\Tenancy\Traits\UsesTenantConnection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Models\Order\OrderBundle
 *
 * @property int $id
 * @property int $bundle_id
 * @property string $name 组合名称
 * @property int $order_id
 * @property float|null $amount 组合价格
 * @property string|null $rental_out_at 出库时间
 * @property string|null $return_at 入库时间
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Order\OrderBundleItem[] $items
 * @property-read int|null $items_count
 * @property-read \App\Models\Order\Order $order
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Order\OrderBundle onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereAmount($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereBundleId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereOrderId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereRentalOutAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereReturnAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Order\OrderBundle whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Order\OrderBundle withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Order\OrderBundle withoutTrashed()
 * @mixin \Eloquent
 */
class OrderBundle extends Model
{
    use SoftDeletes, UsesTenantConnection;

    public function order()
    {
        return $this->belongsTo(Order::class);
    }

    public function items()
    {
        return $this->hasMany(OrderBundleItem::class);
    }
}
